<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>
        <ui:composition template="/publico/template.xhtml">
            <ui:define name="content">
                <p:messages/>
                <h:form id="ftrituracao" >
                    <p:panel header="Trituração">
                        <h:panelGrid columns="2">
                            <h:outputLabel 
                                for="itLote" 
                                value="Lote: "/>
                            <h:inputText 
                                id="itLote"
                                readonly="true"
                                value="#{processoBean.processo.id}"/>

                            <h:outputLabel 
                                for="itmassa" 
                                value="Massa Peneirada: *"/>
                            <p:inputText
                                id="itmassa"
                                value="#{processoBean.trituracao.massaPeneirada}"/>

                            <h:outputLabel 
                                id="oltrituracao"
                                for="cdatatrituracao" 
                                value="Data da trituração: *"/>
                            <p:calendar 
                                id="cdatatrituracao" 
                                value="#{processoBean.trituracao.dataDeTrituracao}"
                                required="true"/>

                            <h:outputLabel 
                                id="olaplicacaopellet"
                                for="soaplicacaopellet"   
                                value="Aplicacao do pellet: *"/>
                            <h:selectOneMenu 
                                id="soaplicacaopellet" 
                                value="#{processoBean.trituracao.aplicacaoTrituracao}"
                                converter="AplicacaoConversor">
                                <f:selectItems value="#{aplicacaoBean.aplicacoes}"
                                               var="a"
                                               itemLabel="#{a.nome}"
                                               itemValue="#{a}"/>
                            </h:selectOneMenu>

                            <h:outputLabel 
                                for="solocal" 
                                value="Local: "/>
                            <h:selectOneMenu 
                                id="solocal" 
                                value="#{processoBean.trituracao.localTrituracao}"
                                converter="LocalConversor">
                                <f:selectItems value="#{localBean.locais}"
                                               var="l"
                                               itemLabel="#{l.nome}"
                                               itemValue="#{l}"/>
                            </h:selectOneMenu>

                            <h:outputLabel 
                                for="sometodo" 
                                value="Metodo de Trituração: *"/>
                            <h:selectOneMenu 
                                id="sometodo" 
                                value="#{processoBean.trituracao.metodoDeTrituracao}"
                                converter="MetodoDeTrituracaoConversor">
                                <f:selectItems value="#{metodoDeTrituracaoBean.metodosDeTrituracoes}" 
                                               var="m"
                                               itemLabel="${m.nome}"
                                               itemValue="#{m}"/>
                            </h:selectOneMenu>
                        </h:panelGrid>

                        <p:commandButton id="cbsalvar"
                                         ajax="false" 
                                         action="#{processoBean.salvarTrituracao()}" 
                                         value="Salvar"/>

                        <p:button id="cbcancelar"
                                  value="Cancelar"
                                  outcome="/restrito/lote/informacao-lote.xhtml"/>
                    </p:panel>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>
